package com.demo.web;

import com.demo.service.SearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class HelloController {

    @Value("${spring.application.name}")
    private String appName;

    @Value("${iris2.reco.data.index-name}")
    private String indexName;

    @Value("${profile.desc}")
    private String profileDesc;

    @GetMapping("/hello")
    public String sayHello() {
        log.info("appName: {}", appName);
        log.info("indexName: {}", indexName);
        log.info("profileDesc: {}", profileDesc);
        return "Hello, World!";
    }

    @Autowired
    SearchService searchService;

    @GetMapping("/search")
    public String search() {
        return searchService.search("demo");
    }

}
